<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>发表评价</title>
	<meta name="ali-app-title-content" content="e6a9"/>
  <meta name="ali-app-title-color" content="#dd2727"/>
  <meta name="aplus-terminal" content="1"/>
	<meta name="apple-mobile-web-app-title" content="TMALL"/>
	<meta name="apple-mobile-web-app-capable" content="yes"/>
	<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/>
	<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"/>
	<meta name="spm-id" content="a3204.7152233">
	<link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico"/>
 　 <meta name="format-detection" content="telephone=no, address=no">
	<link rel="stylesheet" href="css/pingjia.css" type="text/css">
	<meta name="viewport" content="initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
	<meta name="format-detection" content="telphone=no, email=no"/>
	<script type="text/javascript" src="js/jquery-1.11.2.js" ></script>
	<script>
		document.documentElement.style.fontSize=innerWidth/6.4+"px";
		onresize=function(){
 	  	document.documentElement.style.fontSize=innerWidth/6.4+"px";
		}
	</script>
</head>
<body>
	
	<div class="box">
		<p id="tex"></p>
		<span id="span">确定</span>
	</div>
<div class="pJ_top">
	<div class="pJ_top_fh" id="pJ_top_fh">
		<img src="img/pp10.jpg" id="hui"/>
	</div>
	<div class="pJ_top_txt">发表评论</div>
	<div class="pJ_top_deng">
		<img src="img/pp11.jpg"  alt="" />
	</div>
</div>

<div class="pJ_qin">
	<div class="pJ_qin_top">
		<div class="pJ_qin_book">
			<img src="img/tu.jpg" alt="" id="jpg" />
		</div>
		<input type="text" id="pinglun" placeholder="亲！请对商品进行品论" />
		<div class="pJ_qin_ly">
			<img src="img/pp9.jpg" alt="" />
		</div>
	</div>
	<div class="pJ_qin_cen">
		<div class="pJ_qin_xj">
			<img src="img/pp12.jpg" alt="" />
		</div>
	</div>
	<div class="pJ_qin_bot">
		<div class="pJ_qin_ping" thisIndex="1">
			<img src="img/pp14.jpg" alt="" />
			<p>好评</p>
		</div>
		<div class="pJ_qin_ping" thisIndex="2">
			<img src="img/pp14.jpg" alt="" />
			<p>中评</p>
		</div>
		<div class="pJ_qin_ping" thisIndex="3">
			<img src="img/pp15.jpg" alt="" />
			<p>差评</p>
		</div>
	</div>
</div>

<div class="pJ_dianpu">
	<div class="pJ_dianpu_nei">
		<h3>店铺评分</h3>
		<p>
			<span>描述相符</span>
			<span class="pJ_xing">
				<a></a>
				<a></a>
				<a></a>
				<a></a>
				<a></a>
			</span>
		</p>
		<p>
			<span>物流服务</span>
			<span class="pJ_xing">
				<a></a>
				<a></a>
				<a></a>
				<a></a>
				<a></a>
			</span>
		</p>
		<p>
			<span>服务态度</span>
			<span class="pJ_xing">
				<a></a>
				<a></a>
				<a></a>
				<a></a>
				<a></a>
			</span>
		</p>
	</div>
</div>

<div class="pJ_Niming">
	<div class="pJ_Niming_nei">
		<div class="pJ_Niming_left">
			<div class="pJ_PJ"><img src="img/pp18.jpg"/></div>匿名评价
		</div>
		<div class="pJ_Niming_right">
			发表评价
		</div>
	</div>
</div>

<script>
//后退
	$("#hui").click(function(){
		history.back(-1)
	})	

	
	
	//设置当前商品的图片src
		if(sessionStorage.thisImgSrc){
			$("#jpg").prop("src",sessionStorage.thisImgSrc);
		}
	
	
	//获取评论的内容
	var val="";
	$("#pinglun").blur(function(){
		val=$("#pinglun").val();
		if(val==''){
			$(".box").show();
			$("#tex").text("请发表您对商品是否满意")
		}
	})
		
	//点击选择好中差评
	var eval=0;
	var pj=$(".pJ_qin_ping").click(function(){
		eval=$(this).index()+1
		if($(this).index()==0){
			$(this).find("img").attr("src","img/pp13.jpg");
			$(this).next().find("img").attr("src","img/pp14.jpg");
			$(this).next().next().find("img").attr("src","img/pp15.jpg");
		}else if($(this).index()==1){
			$(this).find("img").attr("src","img/pp13.jpg");
			$(this).prev().find("img").attr("src","img/pp14.jpg");
			$(this).next().find("img").attr("src","img/pp15.jpg");
		}else if($(this).index()==2){
			$(this).find("img").attr("src","img/pp-21.jpg");
			$(this).prev().find("img").attr("src","img/pp14.jpg");
			$(this).prev().prev().find("img").attr("src","img/pp14.jpg");
		}		
	})
		
	//点击评论
	$(".pJ_Niming_right").click(function(){
		if(val==""&&eval==0){
			$(".box").show();
			$("#tex").text("请对商品进行评价")
		}else{
		var aa=localStorage.dizhi.split("-")
				//评价接口：
			$.ajax({
				type:"get",
				url: "http://192.168.1.100/supermarket/data/evaluate.php",
				
				
	data: {'evaluate':eval,'commodity_id': sessionStorage.thisId, 'user_name':aa[0],'evaluate_info':$("#pinglun").val(),'user_phone':aa[1]},			
				
				dataType:"jsonp",
				jsop:"callback",
				async:true,
				success:function(data){
					console.log(data)
					if(data.msg=="error"){
						$(".box").show();
						$("#tex").text("请对商品进行评价")
					}else if(data[0].msg=="success"){
						console.log(data);
						window.location.href="shangpin.html?id="+sessionStorage.thisId;
					}
					
				}
			});		
		}
	})
		
	//点击弹框消失
	$("#span").click(function(){
		$(".box").hide()
	})


	
</script>


</body>
</html>